package com.leyou.trade.utils;

import com.leyou.auth.dto.UserDetail;
import com.leyou.auth.utils.UserContext;

@SuppressWarnings("ALL")
/**
 * @Description :
 * @author     :LD
 */
public class CollectionNameBuilder {
    private final String namePrefix;

    public CollectionNameBuilder(String namePrefix) {
        this.namePrefix = namePrefix;
    }

    public String build(){
        UserDetail user = UserContext.getUser();
        if (user==null){
            return "";
        }
        //获取collection前缀
        return namePrefix+user.getId().hashCode()%100;
    }
}
